<!-- 
	没有钱的会员才会用的那种自动回复的垃圾客服
	有钱的甲方爸爸客服系统 请移步 ->  /userPage/message/consult
 -->
<template>
	<view class="page">
		<navBar :title="title"></navBar>
		<web-view class="webView" :src="urls"></web-view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			urls: '',
			title: ''
		};
	},

	onLoad(e) {
		if (e.isURL) {
			this.urls = e.isURL;
		} else if (e.encodeURI) {
			this.urls = decodeURIComponent(e.encodeURI);
		} else {
			let bid = uni.getStorageSync('bid');
			let vid = uni.getStorageSync('vid');
			if (e.goodsId) {
				this.urls =
					'https://sra.weikebaba.com/index.php/answerServiceApp/wapIndex/VeriCode/' + bid + '/source/' + this.$http.source + '/goodsId/' + e.goodsId + '/vId/' + vid;
			} else if (e.actId) {
				this.urls =
					'https://sra.weikebaba.com/index.php/answerServiceApp/wapIndex/VeriCode/' + bid + '/source/' + this.$http.source + '/goodsId/' + e.actId + '/vId/' + vid;
			} else {
				this.urls = 'https://sra.weikebaba.com/index.php/answerServiceApp/wapIndex/VeriCode/' + bid + '/source/' + this.$http.source + '/vId/' + vid;
			}
		}
		this.getAuthenticationState();
		var pages = getCurrentPages();
	},
	methods: {
		getAuthenticationState() {
			this.$http
				.get({
					url: '/cxtApi/getAuthenticationState'
				})
				.then((res) => {
					if (res.code != 200) return this.$Toast(res.msg);
					if (res.data == 0) {
						setTimeout(() => {
							this.getAuthenticationState();
						}, 2000);
					} else {
						uni.navigateBack({
							delta: 1
						});
					}
				});
		}
	},
	onShareAppMessage() {
		let shareData = uni.getStorageSync('shareData');
		let vid = uni.getStorageSync('vid');
		return {
			title: shareData.title,
			desc: shareData.desc,
			path: '/pages/index/index?share_v_id=' + vid,
			imageUrl: shareData.imageUrl
		};
	}
};
</script>
